import { h } from 'vue';
import { CaretDownFilled } from '@ant-design/icons-vue';

// 定义 filterIcon 方法
const filterIcon = ({ filtered, column }: { filtered: boolean; column: any; }) => {
    return h(CaretDownFilled, {
        style: {
            color: filtered ? '#ABBACD' : undefined,
        },
        onClick: () => {
            // 这里的 onFilter 需要外部传入或通过其他方式获取
            if (column && column.onFilter) {
                column.onFilter(null, column);
            }
        },
    }) as any;
};

export const commonColumns:Array<Object> = [
    {
        title: '分校',
        dataIndex: 'school',
        key: 'schools',
        filterIcon,
        width: 80,
        fixed: 'left',
        formType: 'select',
        customFilterDropdown: true,
    },
    {
        title: '科目',
        dataIndex: 'subject',
        key: 'subjects',
        filterIcon,
        width: 80,
        fixed: 'left',
        formType: 'select',
        customFilterDropdown: true,
    },
    {
        title: '年级',
        dataIndex: 'grade',
        key: 'grades',
        filterIcon,
        width: 80,
        fixed: 'left',
        formType: 'select',
        customFilterDropdown: true,
    },
    {
        title: '分校确认人',
        dataIndex: 'schoolConfirm',
        key: 'schoolConfirms',
        filterIcon,
        width: 140,
        fixed: 'left',
        formType: 'select',
        otherFormType: 'search',
        customFilterDropdown: true,
    },
    {
        title: '部门确认人',
        dataIndex: 'deptConfirm',
        key: 'deptConfirms',
        filterIcon,
        width: 140,
        fixed: 'left',
        formType: 'select',
        otherFormType: 'search',
        customFilterDropdown: true,
    },
    {
        title: '招聘需求',
        dataIndex: 'recruitNum',
        key: 'recruitNum',
        sorter: true,
        width: 120,
        fixed: 'left',
    },
    {
        title: '暑招生目标',
        dataIndex: 'summerEnrollment',
        key: 'summerEnrollment',
        sorter: true,
        width: 100,
    },
    {
        title: '满班率目标',
        dataIndex: 'fullClassRate',
        key: 'fullClassRate',
        sorter: true,
        width: 100,
    },
    {
        title: '班级限额',
        dataIndex: 'classQuota',
        key: 'classQuota',
        sorter: true,
        width: 100,
    },
    {
        title: '开班数',
        dataIndex: 'openedClassesNum',
        key: 'openedClassesNum',
        sorter: true,
        width: 100,
    },
    {
        title: '人均带班量',
        dataIndex: 'classesNum',
        key: 'classesNum',
        sorter: true,
        width: 100,
    },
    {
        title: '老师总数',
        dataIndex: 'allTeachersNum',
        key: 'allTeachersNum',
        sorter: true,
        width: 100,
    },
    {
        title: '现有老师',
        dataIndex: 'teachersNum',
        key: 'teachersNum',
        sorter: true,
        width: 100,
    },
    {
        title: '操作',
        dataIndex: 'edit',
        fixed: 'right',
        key: 'edit',
        width: 80
    },
]

export const selectOptions = {
    deptConfirms: {
        requestType: 'ALL',
        requestApi: 'selectUserByRole',
        placeholder: '部门确认人',
        option: []
    },
    schoolConfirms: {
        requestType: 'ALL',
        requestApi: 'selectUserByRole',
        placeholder: '分校确认人',
        option: []
    },
    grades: {
        requestType: '3',
        requestApi: 'selectCommonConfig',
        placeholder: '年级',
        option: []
    },
    subjects:{
        requestType: '2',
        requestApi: 'selectCommonConfig',
        placeholder: '科目',
        option: []
    },
    schools:{
        requestType: '1',
        requestApi: 'selectCommonConfig',
        placeholder: '分校',
        option: []
    }
}